﻿using System.Data;
using System.IO;
using System.Web.UI.WebControls;
using ContractManagementSystem.DataAccessLayer;
using ContractManagementSystem.EntityObjects;

namespace ContractManagementSystem.BusinessLogicLayer
{
    public static class ContractLogic
    {
         // Get list of active contracts
        public static DataTable ListActiveContracts()
        {
            return ContractDao.ListActiveContracts();
        }



        // Find contracts
        public static DataTable FindContract(ContractEntity contractEntity, string[] operationArrays, int findingOptions)
        {
            /* operationArrays[0] = operation for field Created date
             * operationArrays[1] = operation for field Start date
             * operationArrays[2] = operation for field End date
             * operationArrays[3] = operation for field Contract value
             */
            return ContractDao.FindContract(contractEntity, operationArrays, findingOptions);
        }

        //add by chinhbv
        public static DataTable ListActiveContractsByContractor(string userName)
        {
            var result = ContractDao.ListActiveContractsByContractor(userName);
            return result;
        }
        public static DataTable ListActiveContractsByConsultant(string user)
        {
            var result = ContractDao.ListActiveContractsByConsultant(user);
            return result;
        }
        //search page report contract by admin
        public static DataTable ReportSearchContract(ContractEntity contractEntity)
        {
            var result = ContractDao.ReportSearchContract(contractEntity);
            return result;
        }
        //search page report contract by consultant
        public static DataTable ReportSearchContractByConsultant(string user, ContractEntity contractEntity)
        {
            var result = ContractDao.ReportSearchContractByConsultant(user, contractEntity);
            return result;
        }

    }
}
